Skip to content

feat(contracts): multisig event registry (#292) + event batch (#293) + DID resolver (#295) - #400

Open
Divine-designs wants to merge 1 commit into
soroventures:mainfrom
Divine-designs:feat/issues-292-293-295-multisig-batch-did
Open

feat(contracts): multisig event registry (#292) + event batch (#293) + DID resolver (#295)#400
Divine-designs wants to merge 1 commit into
soroventures:mainfrom
Divine-designs:feat/issues-292-293-295-multisig-batch-did

Conversation

@Divine-designs

Copy link
Copy Markdown

Summary

Three new Soroban contracts added under contracts/, each with its own docs/<name>.md reference doc.

Issue #292 — Multi-Signature Registry for High-Value Event Emission

New contract: contracts/multisig_event_registry

  • M-of-N signer set configured at init; admin can override per-event-type threshold via set_threshold(event_type, threshold).
  • propose(event_type, topic2, data) returns proposal_id and records the proposer's vote. approve(proposal_id) auto-executes once the threshold is met, emitting both the underlying caller-requested event and a ms_attest event with (proposal_id, event_type, approvals: Vec<Address>) for non-repudiation.
  • cancel(proposal_id) callable by proposer or admin while pending.

Issue #293 — Gas-Optimized Event Batching Utility Contract

New contract: contracts/event_batch

  • emit_batch(sender, entries: Vec<EventEntry>) -> u32 emits up to MAX_BATCH_SIZE (64) events plus a single batch_emt summary in one invocation, amortizing dispatch + auth overhead.
  • EventEntry { topic, topic2: Bytes, data: Bytes } is storage-efficient: topics are inline, payload is type-erased so a single batch can mix event shapes.

Issue #295 — Decentralized Identity (DID) Resolver on Soroban

New contract: contracts/did_resolver

  • W3C-DID-Core alignment: register / update / resolve / revoke. DID documents stored as opaque Bytes keyed by did:soroban:<id>. Single controller per DID. Monotonic version counter on update; revoked DIDs resolve to Some(doc) with status = Revoked (not None) and are non-recyclable.
  • Event-based identity verification updates: every state transition emits a did_attst event with (did, controller, version) — a verifier can subscribe and react without polling.
  • On-chain resolution: resolve(did) and status(did) read directly from persistent storage.

Acceptance Criteria

Issue Feature implemented Tests Docs updated
#292 ✅ 7 tests docs/multisig_event_registry.md
#293 ✅ 5 tests docs/event_batch.md
#295 ✅ 9 tests docs/did_resolver.md

Verification

cargo build -p event-horizon-multisig-event-registry \
            -p event-horizon-event-batch \
            -p event-horizon-did-resolver           #
cargo test  -p event-horizon-multisig-event-registry \
            -p event-horizon-event-batch \
            -p event-horizon-did-resolver           # ✅ 21/21 tests pass

All three crates added to contracts/Cargo.toml workspace members. Test snapshots are committed alongside the tests.

Closes #292
Closes #293
Closes #295

… (#293) + DID resolver (#295)

Three new Soroban contracts added under contracts/, each with its own
docs/<name>.md file.

#292 — Contract: Multi-Signature Registry for High-Value Event Emission
- New contract `multisig_event_registry`.
- M-of-N signer set configured at init; admin can override per-event-type
  threshold via `set_threshold`.
- `propose(event_type, topic2, data)` → returns proposal_id and records
  the proposer's vote; `approve(proposal_id)` auto-executes once the
  threshold is met, emitting both the underlying caller-requested event
  AND a `ms_attest` event with the full signer-approval list for
  non-repudiation. `cancel(proposal_id)` callable by proposer/admin.
- 7 tests cover: threshold-1 instant execution, threshold-2 with second
  approval, non-signer rejected, double-approve rejected, per-event
  threshold override, proposer cancellation, init validation.

#293 — Contract: Gas-Optimized Event Batching Utility Contract
- New contract `event_batch`.
- `emit_batch(sender, entries: Vec<EventEntry>) -> u32` emits up to
  MAX_BATCH_SIZE (64) events plus a single `batch_emt` summary in one
  invocation, amortizing dispatch + auth overhead.
- `EventEntry { topic, topic2, data: Bytes }` carries type-erased
  payloads so a single batch can mix event shapes.
- 5 tests cover: 2-event batch + summary, dual-topic entry, empty
  batch rejected, oversized batch rejected, full MAX_BATCH_SIZE batch.

#295 — Contract: Decentralized Identity (DID) Resolver on Soroban
- New contract `did_resolver`.
- W3C-DID-Core CRUD: register/update/resolve/revoke. DID documents
  stored as opaque `Bytes` keyed by `String` (intended to be the full
  `did:soroban:<id>` string). Single controller per DID.
- Monotonic `version` counter on update; revoked DIDs resolve to
  `Some(doc)` with `status = Revoked` rather than `None`, and are
  non-recyclable.
- Every state transition emits a `did_attst` event with `(did,
  controller, version)` — the event-based identity-verification hook
  called out in the issue's technical requirements.
- 9 tests cover: register+resolve, unknown returns None, double-register
  rejected, update bumps version + emits identity attestation, non-
  controller cannot update, revoke still resolves, cannot update after
  revoke, empty did rejected, multi-update identity attestation stream.

Workspace:
- All three crates added to contracts/Cargo.toml workspace members.
- 21/21 tests pass; release builds clean.
- Docs added under docs/ matching the existing per-contract doc style.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant